home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Great Games / 1_1000 Games.iso / CASINO / AMIDA10E.ZIP / AMISRC.ZIP / AMIDA.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1995-03-16  |  24.2 KB  |  808 lines

  1. VERSION 2.00
  2. Begin Form Amida 
  3.    BorderStyle     =   1  '
  4.    FontBold        =   -1  'True
  5.    FontItalic      =   0   'False
  6.    FontName        =   "Arial"
  7.    FontSize        =   9.75
  8.    FontStrikethru  =   0   'False
  9.    FontUnderline   =   0   'False
  10.    Height          =   5850
  11.    Icon            =   AMIDA.FRX:0000
  12.    Left            =   1020
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   5445
  16.    ScaleWidth      =   8340
  17.    Top             =   4350
  18.    Width           =   8460
  19.    Begin PictureBox SobFace 
  20.       Height          =   400
  21.       Left            =   0
  22.       Picture         =   AMIDA.FRX:0302
  23.       ScaleHeight     =   375
  24.       ScaleWidth      =   375
  25.       TabIndex        =   29
  26.       TabStop         =   0   'False
  27.       Top             =   1920
  28.       Visible         =   0   'False
  29.       Width           =   400
  30.    End
  31.    Begin PictureBox SmileFace 
  32.       Height          =   400
  33.       Left            =   0
  34.       Picture         =   AMIDA.FRX:057C
  35.       ScaleHeight     =   375
  36.       ScaleWidth      =   375
  37.       TabIndex        =   28
  38.       TabStop         =   0   'False
  39.       Top             =   960
  40.       Visible         =   0   'False
  41.       Width           =   400
  42.    End
  43.    Begin PictureBox CalmFace 
  44.       Height          =   400
  45.       Left            =   0
  46.       Picture         =   AMIDA.FRX:07F6
  47.       ScaleHeight     =   375
  48.       ScaleWidth      =   375
  49.       TabIndex        =   27
  50.       TabStop         =   0   'False
  51.       Top             =   1440
  52.       Visible         =   0   'False
  53.       Width           =   400
  54.    End
  55.    Begin PictureBox Lot 
  56.       BorderStyle     =   0  '
  57.       Height          =   400
  58.       Index           =   19
  59.       Left            =   0
  60.       ScaleHeight     =   405
  61.       ScaleWidth      =   405
  62.       TabIndex        =   0
  63.       TabStop         =   0   'False
  64.       Top             =   480
  65.       Visible         =   0   'False
  66.       Width           =   400
  67.    End
  68.    Begin PictureBox Lot 
  69.       BorderStyle     =   0  '
  70.       Height          =   400
  71.       Index           =   18
  72.       Left            =   0
  73.       ScaleHeight     =   405
  74.       ScaleWidth      =   405
  75.       TabIndex        =   7
  76.       TabStop         =   0   'False
  77.       Top             =   480
  78.       Visible         =   0   'False
  79.       Width           =   400
  80.    End
  81.    Begin PictureBox Lot 
  82.       BorderStyle     =   0  '
  83.       Height          =   400
  84.       Index           =   17
  85.       Left            =   0
  86.       ScaleHeight     =   405
  87.       ScaleWidth      =   405
  88.       TabIndex        =   8
  89.       TabStop         =   0   'False
  90.       Top             =   480
  91.       Visible         =   0   'False
  92.       Width           =   400
  93.    End
  94.    Begin PictureBox Lot 
  95.       BorderStyle     =   0  '
  96.       Height          =   400
  97.       Index           =   16
  98.       Left            =   0
  99.       ScaleHeight     =   405
  100.       ScaleWidth      =   405
  101.       TabIndex        =   9
  102.       TabStop         =   0   'False
  103.       Top             =   480
  104.       Visible         =   0   'False
  105.       Width           =   400
  106.    End
  107.    Begin PictureBox Lot 
  108.       BorderStyle     =   0  '
  109.       Height          =   400
  110.       Index           =   15
  111.       Left            =   0
  112.       ScaleHeight     =   405
  113.       ScaleWidth      =   405
  114.       TabIndex        =   10
  115.       TabStop         =   0   'False
  116.       Top             =   480
  117.       Visible         =   0   'False
  118.       Width           =   400
  119.    End
  120.    Begin PictureBox Lot 
  121.       BorderStyle     =   0  '
  122.       Height          =   400
  123.       Index           =   14
  124.       Left            =   0
  125.       ScaleHeight     =   405
  126.       ScaleWidth      =   405
  127.       TabIndex        =   11
  128.       TabStop         =   0   'False
  129.       Top             =   480
  130.       Visible         =   0   'False
  131.       Width           =   400
  132.    End
  133.    Begin PictureBox Lot 
  134.       BorderStyle     =   0  '
  135.       Height          =   400
  136.       Index           =   13
  137.       Left            =   0
  138.       ScaleHeight     =   405
  139.       ScaleWidth      =   405
  140.       TabIndex        =   12
  141.       TabStop         =   0   'False
  142.       Top             =   480
  143.       Visible         =   0   'False
  144.       Width           =   400
  145.    End
  146.    Begin PictureBox Lot 
  147.       BorderStyle     =   0  '
  148.       Height          =   400
  149.       Index           =   12
  150.       Left            =   0
  151.       ScaleHeight     =   405
  152.       ScaleWidth      =   405
  153.       TabIndex        =   13
  154.       TabStop         =   0   'False
  155.       Top             =   480
  156.       Visible         =   0   'False
  157.       Width           =   400
  158.    End
  159.    Begin PictureBox Lot 
  160.       BorderStyle     =   0  '
  161.       Height          =   400
  162.       Index           =   11
  163.       Left            =   0
  164.       ScaleHeight     =   405
  165.       ScaleWidth      =   405
  166.       TabIndex        =   14
  167.       TabStop         =   0   'False
  168.       Top             =   480
  169.       Visible         =   0   'False
  170.       Width           =   400
  171.    End
  172.    Begin PictureBox Lot 
  173.       BorderStyle     =   0  '
  174.       Height          =   400
  175.       Index           =   10
  176.       Left            =   0
  177.       ScaleHeight     =   405
  178.       ScaleWidth      =   405
  179.       TabIndex        =   15
  180.       TabStop         =   0   'False
  181.       Top             =   480
  182.       Visible         =   0   'False
  183.       Width           =   400
  184.    End
  185.    Begin PictureBox Lot 
  186.       BorderStyle     =   0  '
  187.       Height          =   400
  188.       Index           =   9
  189.       Left            =   0
  190.       ScaleHeight     =   405
  191.       ScaleWidth      =   405
  192.       TabIndex        =   16
  193.       TabStop         =   0   'False
  194.       Top             =   480
  195.       Visible         =   0   'False
  196.       Width           =   400
  197.    End
  198.    Begin PictureBox Lot 
  199.       BorderStyle     =   0  '
  200.       Height          =   400
  201.       Index           =   8
  202.       Left            =   0
  203.       ScaleHeight     =   405
  204.       ScaleWidth      =   405
  205.       TabIndex        =   17
  206.       TabStop         =   0   'False
  207.       Top             =   480
  208.       Visible         =   0   'False
  209.       Width           =   400
  210.    End
  211.    Begin PictureBox Lot 
  212.       BorderStyle     =   0  '
  213.       Height          =   400
  214.       Index           =   7
  215.       Left            =   0
  216.       ScaleHeight     =   405
  217.       ScaleWidth      =   405
  218.       TabIndex        =   18
  219.       TabStop         =   0   'False
  220.       Top             =   480
  221.       Visible         =   0   'False
  222.       Width           =   400
  223.    End
  224.    Begin PictureBox Lot 
  225.       BorderStyle     =   0  '
  226.       Height          =   400
  227.       Index           =   6
  228.       Left            =   0
  229.       ScaleHeight     =   405
  230.       ScaleWidth      =   405
  231.       TabIndex        =   19
  232.       TabStop         =   0   'False
  233.       Top             =   480
  234.       Visible         =   0   'False
  235.       Width           =   400
  236.    End
  237.    Begin PictureBox Lot 
  238.       BorderStyle     =   0  '
  239.       Height          =   400
  240.       Index           =   5
  241.       Left            =   0
  242.       ScaleHeight     =   405
  243.       ScaleWidth      =   405
  244.       TabIndex        =   20
  245.       TabStop         =   0   'False
  246.       Top             =   480
  247.       Visible         =   0   'False
  248.       Width           =   400
  249.    End
  250.    Begin PictureBox Lot 
  251.       BorderStyle     =   0  '
  252.       Height          =   400
  253.       Index           =   4
  254.       Left            =   0
  255.       ScaleHeight     =   405
  256.       ScaleWidth      =   405
  257.       TabIndex        =   21
  258.       TabStop         =   0   'False
  259.       Top             =   480
  260.       Visible         =   0   'False
  261.       Width           =   400
  262.    End
  263.    Begin PictureBox Lot 
  264.       BorderStyle     =   0  '
  265.       Height          =   400
  266.       Index           =   3
  267.       Left            =   0
  268.       ScaleHeight     =   405
  269.       ScaleWidth      =   405
  270.       TabIndex        =   22
  271.       TabStop         =   0   'False
  272.       Top             =   480
  273.       Visible         =   0   'False
  274.       Width           =   400
  275.    End
  276.    Begin PictureBox Lot 
  277.       BorderStyle     =   0  '
  278.       Height          =   400
  279.       Index           =   2
  280.       Left            =   0
  281.       ScaleHeight     =   405
  282.       ScaleWidth      =   405
  283.       TabIndex        =   23
  284.       TabStop         =   0   'False
  285.       Top             =   480
  286.       Visible         =   0   'False
  287.       Width           =   400
  288.    End
  289.    Begin PictureBox Lot 
  290.       BorderStyle     =   0  '
  291.       Height          =   400
  292.       Index           =   1
  293.       Left            =   0
  294.       ScaleHeight     =   405
  295.       ScaleWidth      =   405
  296.       TabIndex        =   24
  297.       TabStop         =   0   'False
  298.       Top             =   480
  299.       Visible         =   0   'False
  300.       Width           =   400
  301.    End
  302.    Begin PictureBox Lot 
  303.       BorderStyle     =   0  '
  304.       Height          =   400
  305.       Index           =   0
  306.       Left            =   0
  307.       ScaleHeight     =   405
  308.       ScaleWidth      =   405
  309.       TabIndex        =   25
  310.       TabStop         =   0   'False
  311.       Top             =   480
  312.       Visible         =   0   'False
  313.       Width           =   400
  314.    End
  315.    Begin CommandButton DrawCmd 
  316.       Caption         =   "&All at once"
  317.       FontBold        =   -1  'True
  318.       FontItalic      =   0   'False
  319.       FontName        =   "Arial"
  320.       FontSize        =   9.75
  321.       FontStrikethru  =   0   'False
  322.       FontUnderline   =   0   'False
  323.       Height          =   492
  324.       Index           =   1
  325.       Left            =   3480
  326.       TabIndex        =   2
  327.       Top             =   0
  328.       Width           =   2532
  329.    End
  330.    Begin CommandButton HelpCmd 
  331.       Caption         =   "&Help"
  332.       FontBold        =   -1  'True
  333.       FontItalic      =   0   'False
  334.       FontName        =   "Arial"
  335.       FontSize        =   9.75
  336.       FontStrikethru  =   0   'False
  337.       FontUnderline   =   0   'False
  338.       Height          =   492
  339.       Left            =   6000
  340.       TabIndex        =   3
  341.       Top             =   0
  342.       Width           =   1212
  343.    End
  344.    Begin CommandButton ExitCmd 
  345.       Cancel          =   -1  'True
  346.       Caption         =   "E&xit"
  347.       FontBold        =   -1  'True
  348.       FontItalic      =   0   'False
  349.       FontName        =   "Arial"
  350.       FontSize        =   9.75
  351.       FontStrikethru  =   0   'False
  352.       FontUnderline   =   0   'False
  353.       Height          =   492
  354.       Left            =   7200
  355.       TabIndex        =   4
  356.       Top             =   0
  357.       Width           =   1212
  358.    End
  359.    Begin CommandButton DrawCmd 
  360.       Caption         =   "&One at a time"
  361.       FontBold        =   -1  'True
  362.       FontItalic      =   0   'False
  363.       FontName        =   "Arial"
  364.       FontSize        =   9.75
  365.       FontStrikethru  =   0   'False
  366.       FontUnderline   =   0   'False
  367.       Height          =   492
  368.       Index           =   0
  369.       Left            =   1200
  370.       TabIndex        =   1
  371.       Top             =   0
  372.       Width           =   2292
  373.    End
  374.    Begin CommandButton NewCmd 
  375.       Caption         =   "&New"
  376.       Default         =   -1  'True
  377.       FontBold        =   -1  'True
  378.       FontItalic      =   0   'False
  379.       FontName        =   "System"
  380.       FontSize        =   9.75
  381.       FontStrikethru  =   0   'False
  382.       FontUnderline   =   0   'False
  383.       Height          =   492
  384.       Left            =   0
  385.       TabIndex        =   26
  386.       Top             =   0
  387.       Width           =   1212
  388.    End
  389.    Begin Label NumPrizesLbl 
  390.       FontBold        =   -1  'True
  391.       FontItalic      =   0   'False
  392.       FontName        =   "System"
  393.       FontSize        =   9.75
  394.       FontStrikethru  =   0   'False
  395.       FontUnderline   =   0   'False
  396.       Height          =   252
  397.       Left            =   120
  398.       TabIndex        =   6
  399.       Top             =   4920
  400.       Width           =   1692
  401.    End
  402.    Begin Label PromptLbl 
  403.       Alignment       =   2  '
  404.       FontBold        =   -1  'True
  405.       FontItalic      =   0   'False
  406.       FontName        =   "System"
  407.       FontSize        =   9.75
  408.       FontStrikethru  =   0   'False
  409.       FontUnderline   =   0   'False
  410.       Height          =   252
  411.       Left            =   1920
  412.       TabIndex        =   5
  413.       Top             =   4920
  414.       Width           =   5412
  415.    End
  416. Dim Shared BarExists() As Integer
  417. Dim Shared PolePos() As Integer
  418. Dim Shared BarPos() As Integer
  419. Dim Shared LotStatus() As Integer
  420. Dim Shared PrizeStatus() As Integer
  421. Dim Shared IsPrize() As Integer
  422. Dim Shared OwnerName$()
  423. Dim Shared PoleInterval As Integer
  424. Dim Shared BarInterval As Integer
  425. Dim Shared PuttingBar As Integer
  426. Dim Shared AddedBarPoleNo As Integer
  427. Dim Shared AddedBarStepNo As Integer
  428. Dim Shared NumDrawnPrizes As Integer
  429. Dim Shared AlreadyDrawnOnce As Integer
  430. Dim Shared JustDrawn As Integer
  431. Dim Shared CharacterBaseFace As Integer
  432. Sub DrawCmd_Click (Index As Integer)
  433.   Dim LotNo As Integer
  434.   If NumLots = 0 Or NumDrawnPrizes = NumPrizes Then
  435.     Beep
  436.     Exit Sub
  437.   End If
  438.   PuttingBar = False
  439.   For LotNo = 1 To NumLots
  440.     If LotStatus(LotNo) = SELECTED Then
  441.       Call DrawLot(LotNo)
  442.       If Index = 0 Or NumDrawnPrizes = NumPrizes Then Exit For
  443.     End If
  444.   Next
  445.   Call Prompt
  446. End Sub
  447. Sub DrawLot (LotNo As Integer)
  448.   Dim PrizePos As Integer
  449.   If JustDrawn Then Refresh
  450.   JustDrawn = True          'This flag indicates a need of redraw lines that was traced when casting a lot
  451.   AlreadyDrawnOnce = True   'This flag prohibits adding more bars
  452.   PrizePos = TraceAmida(LotNo)
  453.   PrizeStatus(PrizePos) = VIEWED
  454.   If IsPrize(PrizePos) Then
  455.     LotStatus(LotNo) = PRIZE
  456.     NumDrawnPrizes = NumDrawnPrizes + 1
  457.   Else
  458.     LotStatus(LotNo) = BLANK
  459.   End If
  460.   Call PrintFace(LotNo, LotStatus(LotNo))
  461.   Call PrintPrize(PrizePos)
  462.   If NumDrawnPrizes >= NumPrizes Then
  463.     'Now all prizes were drawn. So remaining lots are blank!
  464.     For i% = LotNo + 1 To NumLots
  465.       If LotStatus(i%) = SELECTED Then
  466.         LotStatus(i%) = BLANK
  467.         Call PrintFace(i%, LotStatus(i%))
  468.       End If
  469.     Next
  470.     For PrizePos = 1 To NumLots
  471.       If PrizeStatus(PrizePos) = UNKNOWN Then
  472.         PrizeStatus(PrizePos) = VIEWED
  473.         Call PrintPrize(PrizePos)
  474.       End If
  475.     Next
  476.   End If
  477. End Sub
  478. Sub ExitCmd_Click ()
  479.   End
  480. End Sub
  481. Sub Form_Activate ()
  482.   Dim PoleNo As Integer
  483.   Dim StepNo As Integer
  484.   Dim BarAdded As Integer
  485.   If DoNew Then
  486.     ReDim BarExists(NumLots, MaxBars) ' BarExists(NumLots, x) is not used but for avoiding Subscript Out Of Range
  487.     ReDim BarPos(MaxBars + 1)
  488.     ReDim PolePos(NumLots)
  489.     ReDim LotStatus(NumLots)
  490.     ReDim PrizeStatus(NumLots)
  491.     ReDim IsPrize(NumLots)
  492.     ReDim OwnerName$(NumLots)
  493.     NumDrawnPrizes = 0
  494.     AlreadyDrawnOnce = False
  495.     BarInterval = (BottomMost - TopMost) / (MaxBars + 1)
  496.     PoleInterval = (Rightmost - LeftMost) / (NumLots - 1)
  497.     If PoleInterval > 2000 Then PoleInterval = 2000
  498.     For i% = 0 To MaxLots - 1
  499.       Lot(i%).Visible = False
  500.       Lot(i%).Top = 480
  501.       Lot(i%).Left = 0
  502.     Next
  503.     For StepNo = 0 To MaxBars + 1
  504.       BarPos(StepNo) = TopMost + BarInterval * StepNo
  505.     Next
  506. '******************************************************
  507. '       Following code shuffles bars and prizez.
  508. '******************************************************
  509.     Randomize
  510.     For PoleNo = 1 To NumLots
  511.       LotStatus(PoleNo) = FREE
  512.       PrizeStatus(PoleNo) = UNKNOWN
  513.       OwnerName$(PoleNo) = ""
  514.       PolePos(PoleNo) = LeftMost + PoleInterval * (PoleNo - 1)
  515.       If PoleNo < NumLots Then
  516.         BarAdded = False
  517.         Do
  518.           For StepNo = 5 To 34
  519.             If Rnd(1) - (MaxPersons - NumLots) * .02 > .9 Then
  520.               If (PoleNo = 1 Or PoleNo >= 2 And BarExists(PoleNo - 1, StepNo) = False) And BarExists(PoleNo, StepNo - 1) = False Then
  521.                 BarExists(PoleNo, StepNo) = True
  522.                 BarAdded = True
  523.               End If
  524.             End If
  525.           Next
  526.         Loop Until BarAdded
  527.       End If
  528.     Next
  529.     For i% = 1 To NumPrizes
  530.       PoleNo = Int(Rnd(1) * NumLots) + 1
  531.       Do
  532.         If PoleNo > NumLots Then PoleNo = 1
  533.         If IsPrize(PoleNo) = False Then
  534.           IsPrize(PoleNo) = True
  535.           Exit Do
  536.         End If
  537.         PoleNo = PoleNo + 1
  538.       Loop
  539.     Next
  540.     Refresh
  541.     NumPrizesLbl.FontName = "Arial"
  542.     NumPrizesLbl.Caption = "WINS:" + Format$(NumPrizes, " ##")
  543.     DoNew = False
  544.   End If
  545.   Call Prompt
  546. End Sub
  547. Sub Form_Load ()
  548.   NumLots = 0
  549.   NumPrizes = 0
  550.   DoNew = 0
  551.   AppName$ = "Line Lottery"
  552.   Caption = AppName$
  553.   PromptLbl.Caption = ""
  554.   PuttingBar = False
  555.   FontTransParent = False
  556.   If Len(Command$) Then
  557.     CharacterBaseFace = 1
  558.   Else
  559.     CharacterBaseFace = 0
  560.   End If
  561. End Sub
  562. Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  563.   Dim LotNo As Integer
  564.   If NumDrawnPrizes = NumPrizes Then
  565.     Exit Sub
  566.   End If
  567.   If Y <= TopMost And Y >= TopMost - Lot(0).Height - TextHeight(OwnerName$(Num)) - 40 Then
  568.     'Clicked a lot or a owner's face
  569.     LotNo = (X - LeftMost) / PoleInterval + 1
  570.     If LotNo < 1 Then LotNo = 1
  571.     If LotNo > NumLots Then LotNo = NumLots
  572.     Lot_Click (LotNo - 1)
  573.   ElseIf PuttingBar Then
  574.     If AddedBarPoleNo > 0 Then
  575.       'Add a bar for a person
  576.       BarExists(AddedBarPoleNo, AddedBarStepNo) = True
  577.       Line (PolePos(AddedBarPoleNo), BarPos(AddedBarStepNo))-(PolePos(AddedBarPoleNo + 1), BarPos(AddedBarStepNo))
  578.       PuttingBar = False
  579.     Else
  580.       Beep     'Clicked where a bar can't be added
  581.     End If
  582.   End If
  583.   Call Prompt
  584. End Sub
  585. Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  586.   Dim PoleNo As Integer
  587.   Dim StepNo As Integer
  588.   If PuttingBar = False Then Exit Sub
  589.   PoleNo = Int((X - LeftMost) / PoleInterval) + 1
  590.   StepNo = Int((Y - TopMost) / BarInterval + .5)
  591.   If PoleNo < 1 Or PoleNo >= NumLots Or StepNo < 1 Or StepNo > MaxBars Then
  592.     If AddedBarPoleNo > 0 Then
  593.       GoSub ErasePromptingBar
  594.     End If
  595.     AddedBarPoleNo = 0
  596.     Exit Sub
  597.   End If
  598.   If BarExists(PoleNo, StepNo) = False And (PoleNo = NumLots Or BarExists(PoleNo + 1, StepNo) = False) And (PoleNo = 1 Or BarExists(PoleNo - 1, StepNo) = False) Then
  599.     If PoleNo <> AddedPoleNo Or StepNo <> AddedBarStepNo Then
  600.       If AddedBarPoleNo > 0 Then
  601.         GoSub ErasePromptingBar
  602.       End If
  603.     End If
  604.     AddedBarPoleNo = PoleNo
  605.     AddedBarStepNo = StepNo
  606.     DrawStyle = 2  'Dot
  607.     Line (PolePos(AddedBarPoleNo), BarPos(AddedBarStepNo))-(PolePos(AddedBarPoleNo + 1), BarPos(AddedBarStepNo))
  608.     DrawStyle = 0  'Solid
  609.   Else
  610.     GoSub ErasePromptingBar
  611.     AddedBarPoleNo = 0
  612.   End If
  613.   Exit Sub
  614. ErasePromptingBar:
  615.   'Erase the prompting bar which was previously drawn
  616.   CurrentDrawMode = DrawMode
  617.   DrawMode = 4   'Not Copy Pen
  618.   Line (PolePos(AddedBarPoleNo), BarPos(AddedBarStepNo))-(PolePos(AddedBarPoleNo + 1), BarPos(AddedBarStepNo))
  619.   DrawMode = CurrentDrawMode
  620.   PSet (PolePos(AddedBarPoleNo), BarPos(AddedBarStepNo))
  621.   PSet (PolePos(AddedBarPoleNo + 1), BarPos(AddedBarStepNo))
  622.   Return
  623. End Sub
  624. Sub Form_Paint ()
  625.   Dim LotNo As Integer
  626.   Dim StepNo As Integer
  627.   Cls
  628.   DrawWidth = 1
  629.   For LotNo = 1 To NumLots
  630.     Line (PolePos(LotNo), TopMost)-(PolePos(LotNo), BottomMost)
  631.     If LotNo < NumLots Then
  632.       For StepNo = 1 To MaxBars
  633.         If BarExists(LotNo, StepNo) Then
  634.           Line (PolePos(LotNo), BarPos(StepNo))-(PolePos(LotNo + 1), BarPos(StepNo))
  635.         End If
  636.       Next
  637.     End If
  638.     Call PrintFace(LotNo, LotStatus(LotNo))
  639.     Call PrintPrize(LotNo)
  640.   Next
  641.   JustDrawn = False
  642. End Sub
  643. Sub Form_Unload (Cancel As Integer)
  644.   Unload Help
  645. End Sub
  646. Sub HelpCmd_Click ()
  647.   Load Help
  648.   Help.Caption = AppName + "- Help"
  649.   Help.Show
  650. End Sub
  651. Sub Lot_Click (LotIndex As Integer)
  652.   Dim LotNo As Integer
  653.   LotNo = LotIndex + 1
  654.   If LotStatus(LotNo) = FREE Then
  655.     'Allocate a lot to a person
  656.     PuttingBar = False
  657.     PromptLbl.Caption = ""
  658.     Call PrintFace(LotNo, BEINGSELECTED)
  659.     frmName.Show 1
  660.     n$ = frmName.Tag
  661. Rem    n$ = InputBox$("Name ?", AppName$, " ")
  662.     If n$ > "" Then
  663.       OwnerName$(LotNo) = n$
  664.       LotStatus(LotNo) = SELECTED
  665.       Call PrintFace(LotNo, SELECTED)
  666.       If AlreadyDrawnOnce = False Then
  667.         PuttingBar = True
  668.       End If
  669.     Else
  670.       Call PrintFace(LotNo, FREE)
  671.     End If
  672.   ElseIf LotStatus(LotNo) = SELECTED Then
  673.     'Draw a clicked lot
  674.     PuttingBar = False
  675.     Call DrawLot(LotNo)
  676.   ElseIf PuttingBar Then
  677.     Beep
  678.   End If
  679. End Sub
  680. Sub NewCmd_Click ()
  681.   PuttingBar = False
  682.   PromptLbl.Caption = ""
  683.   QueryNum.Show
  684.   Enabled = False
  685. End Sub
  686. Sub PrintFace (Num As Integer, State As Integer)
  687.   Dim NetState As Integer
  688.   If State = PRIZE Or State = BLANK Then
  689.     If State = PRIZE And IsUnwillingPrize = 0 Or State = BLANK And IsUnwillingPrize Then
  690.       NetState = PRIZE
  691.     Else
  692.       NetState = BLANK
  693.     End If
  694.   Else
  695.     NetState = State
  696.   End If
  697.   If State = FREE Or State = BEINGSELECTED Or CharacterBaseFace Then
  698.     Select Case NetState
  699.       Case PRIZE
  700.         If NumLots <= 7 Then
  701.           Face$ = "!(^_^)!"
  702.         ElseIf NumLots <= 10 Then
  703.           Face$ = " (^_^) "
  704.         ElseIf NumLots <= 12 Then
  705.           Face$ = "(^_^)"
  706.         Else
  707.           Face$ = "^_^"
  708.         End If
  709.       Case BLANK
  710.         If NumLots <= 10 Then
  711.           Face$ = " (;_;) "
  712.         ElseIf NumLots <= 12 Then
  713.           Face$ = "(;_;)"
  714.         Else
  715.           Face$ = ";_;"
  716.         End If
  717.       Case SELECTED
  718.         If NumLots <= 12 Then
  719.           Face$ = "(-_-)"
  720.         Else
  721.           Face$ = "-_-"
  722.         End If
  723.       Case BEINGSELECTED
  724.         Face$ = "O"
  725.       Case Else
  726.         Face$ = "@"
  727.     End Select
  728.     CurrentX = PolePos(Num) - TextWidth(Face$) / 2
  729.     CurrentY = TopMost - TextHeight(Face$) - 30
  730.     Print Face$
  731.   Else
  732.     Lot(Num - 1).Top = TopMost - Lot(0).Height - 30
  733.     Lot(Num - 1).Left = PolePos(Num) - Lot(0).Width / 2 + 5
  734.     Select Case NetState
  735.       Case PRIZE
  736.         Lot(Num - 1).Picture = SmileFace.Picture
  737.       Case BLANK
  738.         Lot(Num - 1).Picture = SobFace.Picture
  739.       Case SELECTED
  740.         Lot(Num - 1).Picture = CalmFace.Picture
  741.     End Select
  742.     Lot(Num - 1).Visible = True
  743.   End If
  744.   CurrentX = PolePos(Num) - TextWidth(OwnerName$(Num)) / 2
  745.   CurrentY = TopMost - Lot(0).Height - TextHeight(OwnerName$(Num)) - 40
  746.   FontTransParent = True
  747.   Print OwnerName$(Num)
  748.   FontTransParent = False
  749. End Sub
  750. Sub PrintPrize (Num As Integer)
  751.   If PrizeStatus(Num) = VIEWED Then
  752.     If IsPrize(Num) Then
  753.       X$ = "O"
  754.     Else
  755.       X$ = "X"
  756.     End If
  757.   Else
  758.     X$ = "?"
  759.   End If
  760.   CurrentX = PolePos(Num) - TextWidth(X$) / 2
  761.   CurrentY = BottomMost + 20
  762.   Print X$
  763. End Sub
  764. Sub Prompt ()
  765.   Dim LotNo As Integer
  766.   If PuttingBar Then
  767.     PromptLbl.Caption = "Click the left mouse button to add a horizonal line."
  768.   ElseIf NumDrawnPrizes < NumPrizes Then
  769.     For LotNo = 1 To NumLots
  770.       If LotStatus(LotNo) = FREE Then
  771.         PromptLbl.Caption = "To select, click the left mouse button on a @."
  772.         Exit Sub
  773.       End If
  774.     Next
  775.     PromptLbl.Caption = ""
  776.   ElseIf NumLots > 0 Then
  777.     PromptLbl.Caption = "All prizes have been selected"
  778.   Else
  779.     PromptLbl.Caption = ""
  780.   End If
  781. End Sub
  782. Function TraceAmida (LotNo As Integer)
  783.   Dim PoleNo As Integer
  784.   Dim StepNo As Integer
  785.   DrawWidth = 3
  786.   PoleNo = LotNo
  787.   For StepNo = 1 To MaxBars + 1
  788.     Line (PolePos(PoleNo), BarPos(StepNo - 1))-(PolePos(PoleNo), BarPos(StepNo))
  789.     If StepNo <= MaxBars Then
  790.       If PoleNo < NumLots Then
  791.         If BarExists(PoleNo, StepNo) Then
  792.           Line (PolePos(PoleNo), BarPos(StepNo))-(PolePos(PoleNo + 1), BarPos(StepNo))
  793.           PoleNo = PoleNo + 1          ' go to the right pole
  794.           GoTo NextStep
  795.         End If
  796.       End If
  797.       If PoleNo >= 2 Then
  798.         If BarExists(PoleNo - 1, StepNo) Then
  799.           Line (PolePos(PoleNo - 1), BarPos(StepNo))-(PolePos(PoleNo), BarPos(StepNo))
  800.           PoleNo = PoleNo - 1          ' go to the left pole
  801.         End If
  802.       End If
  803.     End If
  804. NextStep:
  805.   Next
  806.   TraceAmida = PoleNo
  807. End Function
  808.